package com.wxy.zhuzhou;

import com.ak.zhuzhou.R;

import android.app.ActionBar;
import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;

public class UsuActionBarActivity extends Activity{

	private Activity activity;

	public void setActionBar(String titleText, String left, String right,
			Context context, final Activity activity) {
		this.activity = activity;
		View v = LayoutInflater.from(context).inflate(
				R.layout.x_menu_change_data_actionbar, null);
		ActionBar actionBar = activity.getActionBar();
		actionBar.setDisplayHomeAsUpEnabled(false);
		actionBar.setDisplayShowCustomEnabled(true);
		actionBar.setDisplayShowHomeEnabled(false);
		actionBar.setDisplayShowTitleEnabled(false);
		actionBar.setBackgroundDrawable(new ColorDrawable(
				android.R.color.transparent));
		actionBar.setCustomView(v);
		TextView finish = (TextView) v.findViewById(R.id.finishChangeData);
		TextView cancel = (TextView) v.findViewById(R.id.cancelChangeData);
		TextView title = (TextView) v.findViewById(R.id.actionBarTitle);
		title.setText(titleText);
		finish.setText(right);
		cancel.setText(left);
		finish.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				activity.finish();
				
			}
		});
		cancel.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				activity.finish();
				
			}
		});

	}


}
